﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace Weazel.Willows
{
	/// <summary>
	/// Various user-supplied fpga properties
	/// </summary>
	public class Device
	{
		private string package;
		public string Package
		{
			get { return package; }
		}

		private string name;
		public string Name
		{
			get { return name; }
		}

		private string speed;
		public string Speed
		{
			get { return speed; }
		}

		private string family;
		public string Family
		{
			get { return family; }
		}

		public Device(XmlElement description)
		{
			read(description);
		}

		private void read(XmlElement description)
		{
			System.Diagnostics.Trace.Assert(description.Name == "Device");
			System.Diagnostics.Trace.Assert(description["Package"] != null);
			System.Diagnostics.Trace.Assert(description["Name"] != null);
			System.Diagnostics.Trace.Assert(description["Speed"] != null);
			System.Diagnostics.Trace.Assert(description["Family"] != null);

			this.package = description["Package"].InnerText;
			this.name = description["Name"].InnerText;
			this.speed = description["Speed"].InnerText;
			this.family = description["Family"].InnerText;
		}
	}
}
